package com.wc.AlgoOJ_train.train1.c0.A014;

import java.util.Scanner;

/**
 * @Author congge
 * @Date 2023/12/25 11:06
 * @description 数列有序
 * http://43.138.190.70:8888/p/A014
 */
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        while (sc.hasNextInt()) {
            int n = sc.nextInt();
            int iNum = sc.nextInt();
            if (n == 0 && iNum == 0) {
                break;
            }
            boolean flg = false;
            StringBuffer ans = new StringBuffer();
            while (n-- > 0) {
                int num = sc.nextInt();
                if (num < iNum || flg) {
                    ans.append(' ');
                    ans.append(num);
                } else {
                    flg = true;
                    ans.append(' ');
                    ans.append(iNum);
                    ans.append(' ');
                    ans.append(num);
                }
            }
            if (!flg){
                ans.append(' ');
                ans.append(iNum);
            }
            ans.replace(0, 1, "");
            System.out.println(ans);
        }
    }
}
